package demo2;

/**
 * @Author liangzai
 * @Description:
 */
public class Test {
    public void test() {

        class InnerClass {
            public int data1 = 1;

            public void test() {
                System.out.println("Inner::test()");
            }
        }
        //实例化的时候 只能在方法内部 进行实例化
        InnerClass innerClass = new InnerClass();
        innerClass.test();
    }

    public static void main(String[] args) {
        Test test = new Test();
        test.test();
    }

    public static void main3(String[] args) {
        new Test(){

        };
    }



    public void func() {
        System.out.println("func()");
    }

    public static void main1(String[] args) {
        Test test = new Test();
        test.func();
        test.func();

        new Test().func();//匿名对象
        new Test().func();//匿名对象

    }
}
